﻿using System;
namespace Producers.Liiklusregister.Xtee.Riik.Ee.Producer.Liiklusregister {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="soidukiAndmed", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(SoidukiAndmed))]
    public class SoidukiAndmedSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected ISoidukiAndmed clazz;
        
        public SoidukiAndmedSerializer(ISoidukiAndmed clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("soidukId");
            if (clazz.SoidukId!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SoidukId))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SoidukId");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("soidukIdId");
            if (clazz.SoidukIdId!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SoidukIdId))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SoidukIdId");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regMark");
            if (clazz.RegMark!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegMark))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : RegMark");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regTunnistusNr");
            if (clazz.RegTunnistusNr!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegTunnistusNr))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : RegTunnistusNr");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("idKood");
            if (clazz.IdKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IdKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IdKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("vinKood");
            if (clazz.VinKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VinKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VinKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regMass");
            if (clazz.RegMass!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegMass))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : RegMass");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("esmaneRegKp");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.EsmaneRegKp))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("regTunnistusKehtivKuni");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.RegTunnistusKehtivKuni))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("varv");
            if (clazz.Varv!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Varv))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Varv");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("tuubikoodId");
            if (clazz.TuubikoodId!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.TuubikoodId))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : TuubikoodId");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("staatus");
            if (clazz.Staatus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Staatus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Staatus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("aadress");
            if (clazz.Aadress!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Aadress))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Aadress");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("ehakPiirkondId");
            if (clazz.EhakPiirkondId!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EhakPiirkondId))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EhakPiirkondId");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regTunnistuseKp");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.RegTunnistuseKp))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("muutmisaeg");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.Muutmisaeg))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("yldineStaatus");
            if (clazz.YldineStaatus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.YldineStaatus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : YldineStaatus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("mark");
            if (clazz.Mark!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mark))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Mark");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("mudel");
            if (clazz.Mudel!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mudel))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Mudel");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kere");
            if (clazz.Kere!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kere))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kere");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("mootoriVoimsus");
            if (clazz.MootoriVoimsus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MootoriVoimsus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : MootoriVoimsus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("istekohtiMax");
            if (clazz.IstekohtiMax!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IstekohtiMax))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IstekohtiMax");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kategooria");
            if (clazz.Kategooria!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kategooria))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kategooria");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("piirKiirus");
            if (clazz.PiirKiirus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PiirKiirus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PiirKiirus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kytus");
            if (clazz.Kytus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kytus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kytus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("eelmineRegMark");
            if (clazz.EelmineRegMark!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EelmineRegMark))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EelmineRegMark");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("eelmineRegTunnistus");
            if (clazz.EelmineRegTunnistus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EelmineRegTunnistus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EelmineRegTunnistus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("eelmineRiik");
            if (clazz.EelmineRiik!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EelmineRiik))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EelmineRiik");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regMarkKehtivKuni");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.RegMarkKehtivKuni))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("transiitmargiOmanik");
            if (clazz.TransiitmargiOmanik!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.TransiitmargiOmanik))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : TransiitmargiOmanik");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("omanikId");
            if (clazz.OmanikId!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmanikId))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmanikId");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("rentnikId");
            if (clazz.RentnikId!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RentnikId))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : RentnikId");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("isikud");
            if (clazz.Isikud!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikud))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikud");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("teopOpKood");
            if (clazz.TeopOpKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.TeopOpKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : TeopOpKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("teostatudOp");
            if (clazz.TeostatudOp!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.TeostatudOp))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : TeostatudOp");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("teopKuup");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.TeopKuup))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("proovKateg");
            if (clazz.ProovKateg!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ProovKateg))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ProovKateg");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kaasomanikud");
            if (clazz.Kaasomanikud!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kaasomanikud))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kaasomanikud");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="soidukId") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>soidukId");
                }
                clazz.SoidukId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("soidukId")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>soidukId", Reader.LocalName);
            }
            if (Reader.LocalName=="soidukIdId") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>soidukIdId");
                }
                clazz.SoidukIdId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("soidukIdId")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>soidukIdId", Reader.LocalName);
            }
            if (Reader.LocalName=="regMark") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>regMark");
                }
                clazz.RegMark = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regMark")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>regMark", Reader.LocalName);
            }
            if (Reader.LocalName=="regTunnistusNr") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>regTunnistusNr");
                }
                clazz.RegTunnistusNr = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regTunnistusNr")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>regTunnistusNr", Reader.LocalName);
            }
            if (Reader.LocalName=="idKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>idKood");
                }
                clazz.IdKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("idKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>idKood", Reader.LocalName);
            }
            if (Reader.LocalName=="vinKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>vinKood");
                }
                clazz.VinKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vinKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>vinKood", Reader.LocalName);
            }
            if (Reader.LocalName=="regMass") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>regMass");
                }
                clazz.RegMass = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regMass")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>regMass", Reader.LocalName);
            }
            if (Reader.LocalName=="esmaneRegKp") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>esmaneRegKp");
                }
                clazz.EsmaneRegKp = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("esmaneRegKp")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>esmaneRegKp", Reader.LocalName);
            }
            if (Reader.LocalName=="regTunnistusKehtivKuni") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>regTunnistusKehtivKuni");
                }
                clazz.RegTunnistusKehtivKuni = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("regTunnistusKehtivKuni")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>regTunnistusKehtivKuni", Reader.LocalName);
            }
            if (Reader.LocalName=="varv") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>varv");
                }
                clazz.Varv = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("varv")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>varv", Reader.LocalName);
            }
            if (Reader.LocalName=="tuubikoodId") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>tuubikoodId");
                }
                clazz.TuubikoodId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("tuubikoodId")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>tuubikoodId", Reader.LocalName);
            }
            if (Reader.LocalName=="staatus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>staatus");
                }
                clazz.Staatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("staatus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>staatus", Reader.LocalName);
            }
            if (Reader.LocalName=="aadress") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>aadress");
                }
                clazz.Aadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("aadress")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>aadress", Reader.LocalName);
            }
            if (Reader.LocalName=="ehakPiirkondId") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>ehakPiirkondId");
                }
                clazz.EhakPiirkondId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ehakPiirkondId")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>ehakPiirkondId", Reader.LocalName);
            }
            if (Reader.LocalName=="regTunnistuseKp") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>regTunnistuseKp");
                }
                clazz.RegTunnistuseKp = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("regTunnistuseKp")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>regTunnistuseKp", Reader.LocalName);
            }
            if (Reader.LocalName=="muutmisaeg") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>muutmisaeg");
                }
                clazz.Muutmisaeg = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("muutmisaeg")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>muutmisaeg", Reader.LocalName);
            }
            if (Reader.LocalName=="yldineStaatus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>yldineStaatus");
                }
                clazz.YldineStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("yldineStaatus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>yldineStaatus", Reader.LocalName);
            }
            if (Reader.LocalName=="mark") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>mark");
                }
                clazz.Mark = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mark")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>mark", Reader.LocalName);
            }
            if (Reader.LocalName=="mudel") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>mudel");
                }
                clazz.Mudel = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mudel")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>mudel", Reader.LocalName);
            }
            if (Reader.LocalName=="kere") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>kere");
                }
                clazz.Kere = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kere")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>kere", Reader.LocalName);
            }
            if (Reader.LocalName=="mootoriVoimsus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>mootoriVoimsus");
                }
                clazz.MootoriVoimsus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootoriVoimsus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>mootoriVoimsus", Reader.LocalName);
            }
            if (Reader.LocalName=="istekohtiMax") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>istekohtiMax");
                }
                clazz.IstekohtiMax = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("istekohtiMax")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>istekohtiMax", Reader.LocalName);
            }
            if (Reader.LocalName=="kategooria") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>kategooria");
                }
                clazz.Kategooria = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kategooria")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>kategooria", Reader.LocalName);
            }
            if (Reader.LocalName=="piirKiirus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>piirKiirus");
                }
                clazz.PiirKiirus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("piirKiirus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>piirKiirus", Reader.LocalName);
            }
            if (Reader.LocalName=="kytus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>kytus");
                }
                clazz.Kytus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kytus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>kytus", Reader.LocalName);
            }
            if (Reader.LocalName=="eelmineRegMark") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>eelmineRegMark");
                }
                clazz.EelmineRegMark = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("eelmineRegMark")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>eelmineRegMark", Reader.LocalName);
            }
            if (Reader.LocalName=="eelmineRegTunnistus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>eelmineRegTunnistus");
                }
                clazz.EelmineRegTunnistus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("eelmineRegTunnistus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>eelmineRegTunnistus", Reader.LocalName);
            }
            if (Reader.LocalName=="eelmineRiik") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>eelmineRiik");
                }
                clazz.EelmineRiik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("eelmineRiik")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>eelmineRiik", Reader.LocalName);
            }
            if (Reader.LocalName=="regMarkKehtivKuni") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>regMarkKehtivKuni");
                }
                clazz.RegMarkKehtivKuni = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("regMarkKehtivKuni")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>regMarkKehtivKuni", Reader.LocalName);
            }
            if (Reader.LocalName=="transiitmargiOmanik") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>transiitmargiOmanik");
                }
                clazz.TransiitmargiOmanik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("transiitmargiOmanik")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>transiitmargiOmanik", Reader.LocalName);
            }
            if (Reader.LocalName=="omanikId") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>omanikId");
                }
                clazz.OmanikId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("omanikId")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>omanikId", Reader.LocalName);
            }
            if (Reader.LocalName=="rentnikId") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>rentnikId");
                }
                clazz.RentnikId = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("rentnikId")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>rentnikId", Reader.LocalName);
            }
            if (Reader.LocalName=="isikud") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>isikud");
                }
                clazz.Isikud = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikud")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>isikud", Reader.LocalName);
            }
            if (Reader.LocalName=="teopOpKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>teopOpKood");
                }
                clazz.TeopOpKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("teopOpKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>teopOpKood", Reader.LocalName);
            }
            if (Reader.LocalName=="teostatudOp") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>teostatudOp");
                }
                clazz.TeostatudOp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("teostatudOp")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>teostatudOp", Reader.LocalName);
            }
            if (Reader.LocalName=="teopKuup") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>teopKuup");
                }
                clazz.TeopKuup = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("teopKuup")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>teopKuup", Reader.LocalName);
            }
            if (Reader.LocalName=="proovKateg") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>proovKateg");
                }
                clazz.ProovKateg = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("proovKateg")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>proovKateg", Reader.LocalName);
            }
            if (Reader.LocalName=="kaasomanikud") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>soidukiAndmed>kaasomanikud");
                }
                clazz.Kaasomanikud = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kaasomanikud")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>soidukiAndmed>kaasomanikud", Reader.LocalName);
            }
        }
    }
}
